package in.falkeninc.umt_v0_9_8_1;

import com.actionbarsherlock.app.SherlockFragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class ConfigFragment extends SherlockFragment {

	
	public static ConfigFragment newInstance(int index) {

		ConfigFragment f = new ConfigFragment();

		// Supply index input as an argument.
		Bundle args = new Bundle();
		args.putInt("index", index);
		f.setArguments(args);

		return f;	
	}
	

	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

				Toast.makeText(getActivity(), "ConfigFragment: onCreateView", Toast.LENGTH_LONG).show();

				// return container;
				
				//
//				if (container == null) {
				 // We have different layouts, and in one of them this
				 // fragment's containing frame doesn't exist. The fragment
				 // may still be created from its saved state, but there is
				 // no reason to try to create its view hierarchy because it
				 // won't be displayed. Note this is not needed -- we could
				 // just run the code below, where we would create and return
				 // the view hierarchy; it would just never be used.
	//				return null;
		//		}

				// If non-null, this is the parent view that the fragment's UI
				// should be attached to. The fragment should not add the view
				// itself, but this can be used to generate the LayoutParams of
				// the view.
				//

				// programmatically create a scrollview and texview for the text in
				// the container/fragment layout. Set up the properties and add the
				// view.

				
				
/*				ScrollView scroller = new ScrollView(getActivity());
				TextView text = new TextView(getActivity());
//				int padding = (int) TypedValue.applyDimension(
//						TypedValue.COMPLEX_UNIT_DIP, 4, getActivity()
//								.getResources().getDisplayMetrics());
//				text.setPadding(padding, padding, padding, padding);
				
				scroller.addView(text);
				text.setText(Shakespeare.DIALOGUE[getShownIndex()]);
*/				
				
				return inflater.inflate(R.layout.fragment_config, container, false);
				
				
				
	}
	
	public int getShownIndex() {
		return getArguments().getInt("index", 0);
	}	
	
		
}
